import { Component } from '@angular/core';
import { Router } from '@angular/router';
@Component({
  selector: 'find-song',
  templateUrl: './song.component.html',
  styleUrls: ['./song.component.scss']
})
export class SongComponent {
  img:any[] = []

  constructor(private router: Router){
    this.refresh();
  }
  menu():void{
   this.router.navigateByUrl('menu')
  }
  // 刷新
  refresh(){
    this.getMusicImg();
   }
  async getMusicImg(){
    let response = await fetch("http://metapunk.cn:9999/parse/classes/Music", {
      "credentials": "omit",
      "headers": {
          "X-Parse-Application-Id": "dev",
      },
      "method": "GET",
      "mode": "cors"
    })
    let data = await response.json()
    console.log(data)
    this.img = data.results
    console.log(this.img)
  }
}
